export function getTodayDate() {// 获取当天日期
	let now = new Date()
	let year = now.getFullYear() + "-"
	let month = (now.getMonth() + 1)
	if (month < 10) {
		month = "0" + month+"-"
	}else{
		month=month+"-"
	}
	let day = now.getDate()
	if (day < 10) {
		day = "0" + day
	}

	let todayDate=year + month + day

	return todayDate
}

export function getCurrentYearAndMonth() {// 获取当前年月
	let now = new Date()
	let year = now.getFullYear()
	let month = (now.getMonth() + 1)
	if (month < 10) {
		month = "0" + month
	}else{
		month=month
	}
	let result=year + month
	return result
}
export function getMonthBegin() { // 获取当前月的第一天日期
	let now = new Date()
	let year = now.getFullYear() + "-"
	let month = (now.getMonth() + 1)
	if (month < 10) {
		month = "0" + month+"-"
	}else{
		month=month+"-"
	}
	let day = '01'

	let monthBegin=year + month + day
	return monthBegin
}
export function getNowTime() { // 获取当前时间的时分秒
	let now = new Date()
	let hour=now.getHours()
	if(hour<10){
		hour='0'+hour
	}
	let minute=now.getMinutes()
	if(minute<10){
		minute='0'+minute
	}
	let second=now.getSeconds()
	if(second<10){
		second='0'+second
	}

	let nowTime=hour+':'+minute+':'+second
	return nowTime
}
export function getYMD(str) {// 获取日期时间的年月日（既去掉时分秒）
	let date=/\d{4}-\d{1,2}-\d{1,2}/g.exec(str)
	return date[0]
}
